package operation;

import book.Book;
import book.BookList;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2021/11/17
 * \* Time: 13:07
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class FindOperation implements IOperation{
    public void work(BookList bookList){
        System.out.println("查找图书！");
        String name=scanner.nextLine();
        int size=bookList.getUseSize();
        for(int i=0;i<size;i++){
            Book book=bookList.getPos(i);
            if (name.equals(book.getName())){
                System.out.println("找到了这本书，信息如下：");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有找到这本书");
    }
}
